from django.http import HttpResponse
from django.shortcuts import render
from .forms import BotForm

def index(request):
    return render(request, "index.html")


def add_bot(request):
    if request.method == 'POST':  # 当提交表单时
        form = BotForm(request.POST or None)
        if form.is_valid():
            ob_bot = form.save()
            return HttpResponse('OK')
    else:
        form = BotForm()
    context = {
        'form': form
    }
    return render(request,"addbot.html",context)
